Trunking enables the connection of two networked devices together using multiple links between the devices. Using multiple links provides for greater redundancy, e.g., if one of the links fails, the other link may be used. Additionally, multiple links may provide greater bandwidth between the devices and may provide load balancing over the connecting links.
FIG. 1 depicts a high-level block diagram of trunking in use connecting two devices, i.e., a first device 100 such as a switch or a server or other networked device, and a trunk switch 102 able to communicate over either link connecting the two devices. A pair of communication links 104, 106 communicatively connect device 100 and trunk switch 102 to each other. Communication links 104, 106 connect to trunk ports 108, 110, respectively, at trunk switch 102. The pair of communication links 104, 106 are collectively referred to as a trunk 112 (dashed line) connecting device 100 and trunk switch 102.
Assuming device 100 is a switch, FIG. 1 depicts two switches connected via a two-port trunk 112. Specifically, ports 114, 116 connect respectively to trunk ports 108, 110 of trunk switch 102 via links 104, 106. Trunk switch 102 transmits a unicast packet, i.e., a packet sent from one device to one other device, to device 100 by selecting a single link of 104, 106 over which to forward the packet to the device. If trunk switch 102 were to instead transmit the packet on both ports, then device 100 would receive two copies of the same packet and forward both copies, e.g., to downstream-connected devices, thereby increasing, by duplication, the traffic on the network.
The selection of which port to use for forwarding packets is based on the traffic content. Trunk switch 102 performs a hash on several attributes within the particular packet to be forwarded. For example, trunk switch 102 may perform a logical XOR of the source and destination media access control (MAC) addresses and performs a modulus of the hash result based on the number of ports in the trunk, e.g., two ports with respect to trunk 112. Other attributes used during the hash may comprise an Internet protocol (IP) address, a transmission control protocol/user datagram protocol (TCP/UDP) port number, etc.
A type of switch which forwards packets based on a MAC layer address is a layer 2 switch. A feature of a layer 2 switch is that the switch keeps track of the source MAC addresses of received packets and the particular port on which the packet is received. For example, if device 100 transmits traffic, e.g., a communication packet, to trunk switch 102 using link 104 (and which is received at port 108 of the trunk switch), the trunk switch tracks that the device is reachable via trunk (logical port) 112. Trunk switch 102 transmits subsequently received transmissions destined for device 100 by using logical port 112, i.e., one of ports 108, 110.